﻿function hideRightAds() {
	document.getElementById("Box_right").innerHTML = "<p><font size='5'>请合理安排时间上网。</font></p>";
//	document.getElementById("trustPagelet_indexright_recom").innerHTML = "";
//	document.getElementById("trustPagelet_recom_memberv5").innerHTML = "";
//	document.getElementById("pl_rightmod_ads36").innerHTML = "";
//	document.getElementById("pl_rightmod_noticeboard").innerHTML = "";
}

function hideAds() {
	var topHolder = document.getElementById("pl_content_top");
	topHolder.children[0].children[0].children[0].removeChild(topHolder.children[0].children[0].children[0].children[0])
	topHolder.children[0].children[0].children[0].removeChild(topHolder.children[0].children[0].children[0].children[0])
	
	document.getElementsByClassName("title_area clearfix")[0].innerHTML = "";
	document.getElementById("pl_content_biztips").innerHTML = "";
	var contentFeed = document.getElementById("pl_content_homeFeed");
	var adsItems = getElementByAttribute("data-mark", contentFeed);
	adsItems.innerHTML = "";
	
	var bottomAds = getElementByAttribute("ad-data", document.childNodes[1]);
	bottomAds.innerHTML = "";
	
	document.getElementsByClassName("global_footer S_bg4")[0].innerHTML = "";
}

function hideLeft(){
	document.getElementById("pl_leftnav_app").innerHTML = "";
}

function getElementByAttribute(attr, root) {
    root = root || document.body;
    if(root.hasAttribute(attr)) {
        return root;
    }
    var children = root.children, 
        element;
    for(var i = children.length; i--; ) {
        element = getElementByAttribute(attr, children[i]);
        if(element) {
            return element;
        }
    }
    return null;
}

window.onload = function(){
	hideLeft();
	hideRightAds();
	hideAds();
}

	hideLeft();
	hideRightAds();
	hideAds();
